/*
 * @Author: guowu
 * @Date: 2022-02-14 14:42:44
 * @LastEditTime: 2022-02-17 17:20:00
 */
const maxPrice: number = 50;
const minPrice: number = 0;
class rule {
    day: number;
    price: number;
    hasDay: number;
    constructor(day: number, price: number, hasDay: number) {
        this.day = day;
        this.hasDay = hasDay;
        if (price >= maxPrice) {
            this.price = maxPrice;
        } else if (price <= minPrice) {
            this.price = minPrice;
        } else {
            this.price = price;
        }

    }
    backstageTicketsMoney() {
        if (this.day < 5) {
            this.price += 3 * this.hasDay
        }
        else if (this.day < 10) {
            this.price += 2 * this.hasDay
        } else {
            this.price += this.hasDay;
        }
        return this.price;
    }
    agedCheeseMoney() {
        this.price += this.hasDay;
        if (this.price >= maxPrice) {
            this.price = maxPrice;
        }
        return this.price;
    }
    safrasMoney() {
        this.price = this.price;
        return this.price;
    }
    conventionalGoodsMoney() {
        if (this.day < 0) {
            this.price -= this.hasDay * 2
        } else {
            this.price -= this.hasDay
        }
        if (this.price < minPrice) {
            this.price = minPrice
        }
        return this.price;
    }
}
export default rule;